package com.nstar.carousel.mxml.impl
{
	import com.nstar.base.event.AdvanceEvent;
	import com.nstar.carousel.base.CarouselBaseClass;
	
	import flash.events.MouseEvent;
	
	import mx.controls.Button;
	import mx.events.FlexEvent;

	public class CarouselClass extends CarouselBaseClass
	{
		public var btnPrior:Button;
		public var btnNext:Button;
		
		public function CarouselClass()
		{
			super();
			this.addEventListener(FlexEvent.CREATION_COMPLETE,init);
		}
		
		private function init(event:FlexEvent):void{
			
			btnPrior.addEventListener(MouseEvent.CLICK,priorHandler);
			btnNext.addEventListener(MouseEvent.CLICK,nextHandler);
		}
		
		private function priorHandler(event:MouseEvent):void{
			//this.prior();
			this.dispatchEvent(new AdvanceEvent(CarouselBaseClass.PRIOR));
		}
		
		private function nextHandler(event:MouseEvent):void{
			//this.next();
			this.dispatchEvent(new AdvanceEvent(CarouselBaseClass.NEXT));
		}
		
	}
}